home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / COMMDLG.H < prev    next >
C/C++ Source or Header  |  1995-08-14  |  13KB  |  322 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * commdlg.h -   Common dialog functions, types, and definitions               *
  4. *                                                                             *
  5. *               Version 1.0                                                   *
  6. *                                                                             *
  7. \*****************************************************************************/
  8.  
  9. #ifndef __COMMDLG_H     /* prevent multiple includes */
  10. #define __COMMDLG_H
  11.  
  12. #ifndef __WINDOWS_H
  13. #include <windows.h>    /* <windows.h> must be included */
  14. #endif  /* __WINDOWS_H */
  15.  
  16. #ifndef RC_INVOKED
  17. #pragma pack (1)
  18. //#pragma option -a-      /* Assume byte packing throughout */
  19. #endif /* !RC_INVOKED */
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {            /* Assume C declarations for C++ */
  23. #endif  /* __cplusplus */
  24.  
  25. /* If included with the 3.0 windows.h, define compatible aliases */
  26. #if !defined(WINVER) || (WINVER < 0x030a)
  27. //#define WINAPI      FAR PASCAL
  28. //#define CALLBACK    FAR PASCAL
  29. //#define LPCSTR      LPSTR
  30. //#define UINT        WORD
  31. //#define LPARAM      LONG
  32. //#define WPARAM      WORD
  33. //#define LRESULT     LONG
  34. //#define HMODULE     HANDLE
  35. //#define HINSTANCE   HANDLE
  36. //#define HLOCAL      HANDLE
  37. //#define HGLOBAL     HANDLE
  38. #endif  /* WIN3.0 */
  39.  
  40. typedef struct tagOFN
  41. {
  42.     DWORD   lStructSize;
  43.     HWND    hwndOwner;
  44.     HINSTANCE hInstance;
  45.     LPCSTR  lpstrFilter;
  46.     LPSTR   lpstrCustomFilter;
  47.     DWORD   nMaxCustFilter;
  48.     DWORD   nFilterIndex;
  49.     LPSTR   lpstrFile;
  50.     DWORD   nMaxFile;
  51.     LPSTR   lpstrFileTitle;
  52.     DWORD   nMaxFileTitle;
  53.     LPCSTR  lpstrInitialDir;
  54.     LPCSTR  lpstrTitle;
  55.     DWORD   Flags;
  56.     UINT    nFileOffset;
  57.     UINT    nFileExtension;
  58.     LPCSTR  lpstrDefExt;
  59.     LPARAM  lCustData;
  60.     UINT    (CALLBACK *lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  61.     LPCSTR  lpTemplateName;
  62. }   OPENFILENAME;
  63. typedef OPENFILENAME FAR* LPOPENFILENAME;
  64.  
  65. BOOL    WINAPI GetOpenFileName(OPENFILENAME FAR*);
  66. BOOL    WINAPI GetSaveFileName(OPENFILENAME FAR*);
  67. int     WINAPI GetFileTitle(LPCSTR, LPSTR, UINT);
  68.  
  69. #define OFN_READONLY                 0x00000001
  70. #define OFN_OVERWRITEPROMPT          0x00000002
  71. #define OFN_HIDEREADONLY             0x00000004
  72. #define OFN_NOCHANGEDIR              0x00000008
  73. #define OFN_SHOWHELP                 0x00000010
  74. #define OFN_ENABLEHOOK               0x00000020
  75. #define OFN_ENABLETEMPLATE           0x00000040
  76. #define OFN_ENABLETEMPLATEHANDLE     0x00000080
  77. #define OFN_NOVALIDATE               0x00000100
  78. #define OFN_ALLOWMULTISELECT         0x00000200
  79. #define OFN_EXTENSIONDIFFERENT       0x00000400
  80. #define OFN_PATHMUSTEXIST            0x00000800
  81. #define OFN_FILEMUSTEXIST            0x00001000
  82. #define OFN_CREATEPROMPT             0x00002000
  83. #define OFN_SHAREAWARE               0x00004000
  84. #define OFN_NOREADONLYRETURN         0x00008000
  85. #define OFN_NOTESTFILECREATE         0x00010000
  86.  
  87. /* Return values for the registered message sent to the hook function
  88.  * when a sharing violation occurs.  OFN_SHAREFALLTHROUGH allows the
  89.  * filename to be accepted, OFN_SHARENOWARN rejects the name but puts
  90.  * up no warning (returned when the app has already put up a warning
  91.  * message), and OFN_SHAREWARN puts up the default warning message
  92.  * for sharing violations.
  93.  *
  94.  * Note:  Undefined return values map to OFN_SHAREWARN, but are
  95.  *        reserved for future use.
  96.  */
  97.  
  98. #define OFN_SHAREFALLTHROUGH     2
  99. #define OFN_SHARENOWARN          1
  100. #define OFN_SHAREWARN            0
  101.  
  102. typedef struct tagCHOOSECOLOR
  103. {
  104.     DWORD   lStructSize;
  105.     HWND    hwndOwner;
  106.     HWND    hInstance;
  107.     COLORREF rgbResult;
  108.     COLORREF FAR* lpCustColors;
  109.     DWORD   Flags;
  110.     LPARAM  lCustData;
  111.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  112.     LPCSTR  lpTemplateName;
  113. } CHOOSECOLOR;
  114. typedef CHOOSECOLOR FAR *LPCHOOSECOLOR;
  115.  
  116. BOOL    WINAPI ChooseColor(CHOOSECOLOR FAR*);
  117.  
  118. #define CC_RGBINIT               0x00000001
  119. #define CC_FULLOPEN              0x00000002
  120. #define CC_PREVENTFULLOPEN       0x00000004
  121. #define CC_SHOWHELP              0x00000008
  122. #define CC_ENABLEHOOK            0x00000010
  123. #define CC_ENABLETEMPLATE        0x00000020
  124. #define CC_ENABLETEMPLATEHANDLE  0x00000040
  125.  
  126. typedef struct tagFINDREPLACE
  127. {
  128.     DWORD    lStructSize;            /* size of this struct 0x20 */
  129.     HWND     hwndOwner;              /* handle to owner's window */
  130.     HINSTANCE hInstance;             /* instance handle of.EXE that
  131.                                       * contains cust. dlg. template
  132.                                       */
  133.     DWORD    Flags;                  /* one or more of the FR_?? */
  134.     LPSTR    lpstrFindWhat;          /* ptr. to search string    */
  135.     LPSTR    lpstrReplaceWith;       /* ptr. to replace string   */
  136.     UINT     wFindWhatLen;           /* size of find buffer      */
  137.     UINT     wReplaceWithLen;        /* size of replace buffer   */
  138.     LPARAM   lCustData;              /* data passed to hook fn.  */
  139.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  140.                                      /* ptr. to hook fn. or NULL */
  141.     LPCSTR   lpTemplateName;         /* custom template name     */
  142. } FINDREPLACE;
  143. typedef FINDREPLACE FAR *LPFINDREPLACE;
  144.  
  145. #define FR_DOWN                         0x00000001
  146. #define FR_WHOLEWORD                    0x00000002
  147. #define FR_MATCHCASE                    0x00000004
  148. #define FR_FINDNEXT                     0x00000008
  149. #define FR_REPLACE                      0x00000010
  150. #define FR_REPLACEALL                   0x00000020
  151. #define FR_DIALOGTERM                   0x00000040
  152. #define FR_SHOWHELP                     0x00000080
  153. #define FR_ENABLEHOOK                   0x00000100
  154. #define FR_ENABLETEMPLATE               0x00000200
  155. #define FR_NOUPDOWN                     0x00000400
  156. #define FR_NOMATCHCASE                  0x00000800
  157. #define FR_NOWHOLEWORD                  0x00001000
  158. #define FR_ENABLETEMPLATEHANDLE         0x00002000
  159. #define FR_HIDEUPDOWN                   0x00004000
  160. #define FR_HIDEMATCHCASE                0x00008000
  161. #define FR_HIDEWHOLEWORD                0x00010000
  162.  
  163. HWND    WINAPI FindText(FINDREPLACE FAR*);
  164. HWND    WINAPI ReplaceText(FINDREPLACE FAR*);
  165.  
  166. typedef struct tagCHOOSEFONT
  167. {
  168.     DWORD           lStructSize;        /* */
  169.     HWND            hwndOwner;          /* caller's window handle   */
  170.     HDC             hDC;                /* printer DC/IC or NULL    */
  171.     LOGFONT FAR*    lpLogFont;          /* ptr. to a LOGFONT struct */
  172.     int             iPointSize;         /* 10 * size in points of selected font */
  173.     DWORD           Flags;              /* enum. type flags         */
  174.     COLORREF        rgbColors;          /* returned text color      */
  175.     LPARAM          lCustData;          /* data passed to hook fn.  */
  176.     UINT (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  177.                                         /* ptr. to hook function    */
  178.     LPCSTR          lpTemplateName;     /* custom template name     */
  179.     HINSTANCE       hInstance;          /* instance handle of.EXE that
  180.                                          * contains cust. dlg. template
  181.                                          */
  182.     LPSTR           lpszStyle;          /* return the style field here
  183.                                          * must be LF_FACESIZE or bigger */
  184.     UINT            nFontType;          /* same value reported to the EnumFonts
  185.                                          * call back with the extra FONTTYPE_
  186.                                          * bits added */
  187.     int             nSizeMin;           /* minimum pt size allowed & */
  188.     int             nSizeMax;           /* max pt size allowed if    */
  189.                                         /* CF_LIMITSIZE is used      */
  190. } CHOOSEFONT;
  191. typedef CHOOSEFONT FAR *LPCHOOSEFONT;
  192.  
  193. BOOL WINAPI ChooseFont(CHOOSEFONT FAR*);
  194.  
  195. #define CF_SCREENFONTS               0x00000001
  196. #define CF_PRINTERFONTS              0x00000002
  197. #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
  198. #define CF_SHOWHELP                  0x00000004L
  199. #define CF_ENABLEHOOK                0x00000008L
  200. #define CF_ENABLETEMPLATE            0x00000010L
  201. #define CF_ENABLETEMPLATEHANDLE      0x00000020L
  202. #define CF_INITTOLOGFONTSTRUCT       0x00000040L
  203. #define CF_USESTYLE                  0x00000080L
  204. #define CF_EFFECTS                   0x00000100L
  205. #define CF_APPLY                     0x00000200L
  206. #define CF_ANSIONLY                  0x00000400L
  207. #define CF_NOVECTORFONTS             0x00000800L
  208. #define CF_NOOEMFONTS                CF_NOVECTORFONTS
  209. #define CF_NOSIMULATIONS             0x00001000L
  210. #define CF_LIMITSIZE                 0x00002000L
  211. #define CF_FIXEDPITCHONLY            0x00004000L
  212. #define CF_WYSIWYG                   0x00008000L /* must also have CF_SCREENFONTS & CF_PRINTERFONTS */
  213. #define CF_FORCEFONTEXIST            0x00010000L
  214. #define CF_SCALABLEONLY              0x00020000L
  215. #define CF_TTONLY                    0x00040000L
  216. #define CF_NOFACESEL                 0x00080000L
  217. #define CF_NOSTYLESEL                0x00100000L
  218. #define CF_NOSIZESEL                 0x00200000L
  219.  
  220. /* these are extra nFontType bits that are added to what is returned to the
  221.  * EnumFonts callback routine */
  222.  
  223. #define SIMULATED_FONTTYPE      0x8000
  224. #define PRINTER_FONTTYPE        0x4000
  225. #define SCREEN_FONTTYPE         0x2000
  226. #define BOLD_FONTTYPE           0x0100
  227. #define ITALIC_FONTTYPE         0x0200
  228. #define REGULAR_FONTTYPE        0x0400
  229.  
  230. #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
  231.  
  232.  
  233. /* strings used to obtain unique window message for communication
  234.  * between dialog and caller
  235.  */
  236. #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
  237. #define SHAREVISTRING  "commdlg_ShareViolation"
  238. #define FILEOKSTRING   "commdlg_FileNameOK"
  239. #define COLOROKSTRING  "commdlg_ColorOK"
  240. #define SETRGBSTRING   "commdlg_SetRGBColor"
  241. #define FINDMSGSTRING  "commdlg_FindReplace"
  242. #define HELPMSGSTRING  "commdlg_help"
  243.  
  244. /* HIWORD values for lParam of commdlg_LBSelChangeNotify message */
  245. #define CD_LBSELNOITEMS -1
  246. #define CD_LBSELCHANGE   0
  247. #define CD_LBSELSUB      1
  248. #define CD_LBSELADD      2
  249.  
  250. typedef struct tagPD
  251. {
  252.     DWORD   lStructSize;
  253.     HWND    hwndOwner;
  254.     HGLOBAL hDevMode;
  255.     HGLOBAL hDevNames;
  256.     HDC     hDC;
  257.     DWORD   Flags;
  258.     UINT    nFromPage;
  259.     UINT    nToPage;
  260.     UINT    nMinPage;
  261.     UINT    nMaxPage;
  262.     UINT    nCopies;
  263.     HINSTANCE hInstance;
  264.     LPARAM  lCustData;
  265.     UINT    (CALLBACK* lpfnPrintHook)(HWND, UINT, WPARAM, LPARAM);
  266.     UINT    (CALLBACK* lpfnSetupHook)(HWND, UINT, WPARAM, LPARAM);
  267.     LPCSTR  lpPrintTemplateName;
  268.     LPCSTR  lpSetupTemplateName;
  269.     HGLOBAL hPrintTemplate;
  270.     HGLOBAL hSetupTemplate;
  271. } PRINTDLG;
  272. typedef PRINTDLG  FAR* LPPRINTDLG;
  273.  
  274. BOOL    WINAPI PrintDlg(PRINTDLG FAR*);
  275.  
  276. #define PD_ALLPAGES                  0x00000000
  277. #define PD_SELECTION                 0x00000001
  278. #define PD_PAGENUMS                  0x00000002
  279. #define PD_NOSELECTION               0x00000004
  280. #define PD_NOPAGENUMS                0x00000008
  281. #define PD_COLLATE                   0x00000010
  282. #define PD_PRINTTOFILE               0x00000020
  283. #define PD_PRINTSETUP                0x00000040
  284. #define PD_NOWARNING                 0x00000080
  285. #define PD_RETURNDC                  0x00000100
  286. #define PD_RETURNIC                  0x00000200
  287. #define PD_RETURNDEFAULT             0x00000400
  288. #define PD_SHOWHELP                  0x00000800
  289. #define PD_ENABLEPRINTHOOK           0x00001000
  290. #define PD_ENABLESETUPHOOK           0x00002000
  291. #define PD_ENABLEPRINTTEMPLATE       0x00004000
  292. #define PD_ENABLESETUPTEMPLATE       0x00008000
  293. #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000L
  294. #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000L
  295. #define PD_USEDEVMODECOPIES          0x00040000L
  296. #define PD_DISABLEPRINTTOFILE        0x00080000L
  297. #define PD_HIDEPRINTTOFILE           0x00100000L
  298.  
  299. typedef struct tagDEVNAMES
  300. {
  301.     UINT wDriverOffset;
  302.     UINT wDeviceOffset;
  303.     UINT wOutputOffset;
  304.     UINT wDefault;
  305. } DEVNAMES;
  306. typedef DEVNAMES FAR* LPDEVNAMES;
  307.  
  308. #define DN_DEFAULTPRN      0x0001
  309.  
  310. DWORD   WINAPI CommDlgExtendedError(void);
  311.  
  312. #ifdef __cplusplus
  313. }                       /* End of extern "C" { */
  314. #endif  /* __cplusplus */
  315.  
  316. #ifndef RC_INVOKED
  317. #pragma pack ()
  318. //#pragma option -a.      /* Revert to default packing */
  319. #endif  /* RC_INVOKED */
  320.  
  321. #endif  /* __COMMDLG_H */
  322.